package com.yue.jersey.practice.resource;

import com.yue.jersey.practice.annotation.CWord;
import com.yue.jersey.practice.model.WordModel;
import com.yue.jersey.practice.provider.HelloWorldProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

/**
 * 功能描述: TODO <br/>
 * 创建时间: 2016/12/14<br/>
 *
 * @author QiuYang
 */
@Path("hello")
@Component
public class HelloWorldResource {

    @Autowired
    private HelloWorldProvider helloWorldProvider;

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello(@QueryParam("name") @DefaultValue("host") String name){
        return helloWorldProvider.sayHello(name);
    }

    @POST
    public void addHelloWords(WordModel wordModel){
        helloWorldProvider.addHelloWords(wordModel);
    }
}
